package com.lbs.jiepiaisi.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lbs.jiepiaisi.fragment.NewsListFragment;
import com.lbs.jiepiaisi.utils.Constant;

/**
 *
 * 时间：2018/1/12 15:29
 * 作用：
 */

public class NewsViewPagerAdapter  extends FragmentPagerAdapter {
    private String type[] = new String[]{
            Constant.NEWS_TYPE_TOP,
            Constant.NEWS_TYPE_SHEHUI,
            Constant.NEWS_TYPE_GUONEI,
            Constant.NEWS_TYPE_GUOJI,
            Constant.NEWS_TYPE_YULE,
            Constant.NEWS_TYPE_TIYU,
            Constant.NEWS_TYPE_JUNSHI,
            Constant.NEWS_TYPE_KEJI,
            Constant.NEWS_TYPE_CAIJING,
            Constant.NEWS_TYPE_SHISHANG
    };
    private String title[]=new String[]{"头条",
            "社会",
            "国内",
            "国际",
            "娱乐",
            "体育",
            "军事",
            "科技",
            "财经",
            "时尚"
    };

    public NewsViewPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return NewsListFragment.getInstance(type[position]);
    }

    @Override
    public int getCount() {
        return type.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return title[position];
    }
}
